﻿<Page
    x:Class="JE.MicroMVVM.Example.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewModels="using:JE.MicroMVVM.Example.ViewModels"
    xmlns:microMvvm="using:MicroMVVM"
    xmlns:microMvvmNavigation="using:MicroMVVM.Navigation"
    microMvvm:ViewModelLocator.Model="MainPageViewModel"
    microMvvmNavigation:Navigator.IsEnabled="True"
    mc:Ignorable="d">

    <Page.Resources>
        <viewModels:MainPageViewModel x:Key="MainPageViewModel" />
    </Page.Resources>

    <Grid x:Name="MainGrid" Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0" Text="MicroMVVM Example Application" FontSize="30"/>
        <TextBlock Grid.Row="1" Text="{Binding Title}" FontSize="35" />
        <TextBlock Grid.Row="2" Text="{Binding Title1}" FontSize="40" />
        <TextBlock Grid.Row="3" Text="{Binding Title2}" FontSize="40" />
        <TextBlock Grid.Row="4" Text="{Binding Title3}" FontSize="40" />
        <TextBlock Grid.Row="5" Text="{Binding Status}" FontSize="40" />

        <Button Grid.Row="6" Command="{Binding NavigateCommand}" Content="Navigate" />
        <Button Grid.Row="7" Click="NavigateClick" Content="Navigate 2" />
        <Button Grid.Row="8" Command="{Binding StateCommand}" Content="Visual State" />

        <StackPanel x:Name="TestStackPanel">
            <Grid x:Name="GridOne">
                <Grid x:Name="GridTwo">
                    <TextBlock x:Name="TestTextBlock1" />
                    <TextBlock x:Name="TestTextBlock2" />
                    <TextBlock x:Name="TestTextBlock3" />
                </Grid>
            </Grid>
        </StackPanel>

        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="Default">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="MainGrid">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ApplicationPageBackgroundThemeBrush}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <VisualState x:Name="TestState">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="MainGrid">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Red"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</Page>